﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Threading;

namespace RatpConsole
{
    static class Program
    {
        /// <summary>
        /// Point d'entrée principal de l'application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // Initialize Probes
            Probe probe290 = new Probe("290", "Descartes-Galilee", "Issy Val de Seine", "http://www.ratp.fr/horaires/fr/ratp/bus/prochains_passages/PP/B290/290_6293/R", "Bus 290");
            Probe probe179 = new Probe("179", "La Boursidiere", "Robinson RER", "http://www.ratp.fr/horaires/fr/ratp/bus/prochains_passages/PP/B179/179_5206_5436/A", "Bus 179");
            Probe probe595 = new Probe("595", "La Boursidiere", "Robinson RER", "http://www.ratp.fr/horaires/fr/ratp/bus/prochains_passages/PP/B595/595_5131/R", "Bus 595");
            ProbeManager.getInstance().register(probe595);
            ProbeManager.getInstance().register(probe179);
            ProbeManager.getInstance().register(probe290);

            // Initialize Refresh Worker
            ProbeRefreshWorker worker = new ProbeRefreshWorker(1000);
            Thread t = new Thread(new ThreadStart(worker.ThreadLoop));
            t.Start();

            // Initialize Form
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new ConsoleForm());

            // Finalize Refresh Worker
            t.Abort();
        }
    }
}
